package com.nali.spreader.dao.impl;

import com.nali.spreader.dao.ICrudPhoneInfoDao;
import com.nali.spreader.model.PhoneInfo;
import com.nali.spreader.model.PhoneInfoExample;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

@Repository
public class CrudPhoneInfoDao implements ICrudPhoneInfoDao {
    /**
     * This field was generated by Apache iBATIS ibator.
     * This field corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    @Autowired
    private SqlMapClientTemplate sqlMap;

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    public CrudPhoneInfoDao() {
        super();
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    public int countByExample(PhoneInfoExample example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("spreader_tb_phone_info.ibatorgenerated_countByExample", example);
        return count;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    public int deleteByExample(PhoneInfoExample example) {
        int rows = getSqlMapClientTemplate().delete("spreader_tb_phone_info.ibatorgenerated_deleteByExample", example);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    public int deleteByPrimaryKey(Long id) {
        PhoneInfo key = new PhoneInfo();
        key.setId(id);
        int rows = getSqlMapClientTemplate().delete("spreader_tb_phone_info.ibatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    public Long insert(PhoneInfo record) {
        Object newKey = getSqlMapClientTemplate().insert("spreader_tb_phone_info.ibatorgenerated_insert", record);
        return (Long) newKey;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    public Long insertSelective(PhoneInfo record) {
        Object newKey = getSqlMapClientTemplate().insert("spreader_tb_phone_info.ibatorgenerated_insertSelective", record);
        return (Long) newKey;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    @SuppressWarnings("unchecked")
    public List<PhoneInfo> selectByExample(PhoneInfoExample example) {
        List<PhoneInfo> list = getSqlMapClientTemplate().queryForList("spreader_tb_phone_info.ibatorgenerated_selectByExample", example);
        return list;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    public PhoneInfo selectByPrimaryKey(Long id) {
        PhoneInfo key = new PhoneInfo();
        key.setId(id);
        PhoneInfo record = (PhoneInfo) getSqlMapClientTemplate().queryForObject("spreader_tb_phone_info.ibatorgenerated_selectByPrimaryKey", key);
        return record;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    public int updateByExampleSelective(PhoneInfo record, PhoneInfoExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("spreader_tb_phone_info.ibatorgenerated_updateByExampleSelective", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    public int updateByExample(PhoneInfo record, PhoneInfoExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("spreader_tb_phone_info.ibatorgenerated_updateByExample", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    public int updateByPrimaryKeySelective(PhoneInfo record) {
        int rows = getSqlMapClientTemplate().update("spreader_tb_phone_info.ibatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    public int updateByPrimaryKey(PhoneInfo record) {
        int rows = getSqlMapClientTemplate().update("spreader_tb_phone_info.ibatorgenerated_updateByPrimaryKey", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    public SqlMapClientTemplate getSqlMapClientTemplate() {
        return sqlMap;
    }

    /**
     * This class was generated by Apache iBATIS ibator.
     * This class corresponds to the database table spreader.tb_phone_info
     *
     * @ibatorgenerated Fri Aug 23 16:52:22 CST 2013
     */
    private static class UpdateByExampleParms extends PhoneInfoExample {
        private Object record;

        public UpdateByExampleParms(Object record, PhoneInfoExample example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}